﻿using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Text;

namespace StockTools.Model
{
    /// <summary>
    /// 参考价格
    /// </summary>
    public class ConsultModel : BindableBase
    {
        private string gain2;
        private string gain4;
        private string gain6;
        private string gain8;
        private string gain10;
        private string loss2;
        private string loss4;
        private string loss6;
        private string loss8;
        private string loss10;

        public string Gain2 { get => gain2; set => SetProperty(ref gain2, value); }
        public string Gain4 { get => gain4; set => SetProperty(ref gain4, value); }

        public string Gain6 { get => gain6; set => SetProperty(ref gain6, value); }

        public string Gain8 { get => gain8; set => SetProperty(ref gain8, value); }

        public string Gain10 { get => gain10; set => SetProperty(ref gain10, value); }
        public string Loss2 { get => loss2; set => SetProperty(ref loss2, value); }
        public string Loss4 { get => loss4; set => SetProperty(ref loss4, value); }

        public string Loss6 { get => loss6; set => SetProperty(ref loss6, value); }

        public string Loss8 { get => loss8; set => SetProperty(ref loss8, value); }

        public string Loss10 { get => loss10; set => SetProperty(ref loss10, value); }

        /// <summary>
        /// 清空价格参考
        /// </summary>
        public void Clear()
        {
            Gain10 = ""; Gain8 = ""; Gain6 = ""; Gain4 = ""; Gain2 = "";

            Loss10 = ""; Loss8 = ""; Loss6 = ""; Loss4 = ""; Loss2 = "";
        }
        /// <summary>
        /// 计算价格参考
        /// </summary>
        /// <param name="openingPrice"></param>
        public void Compute(decimal openingPrice)
        {
            Gain10 = (openingPrice * 1.1M).ToString("C");
            Gain8 = (openingPrice * 1.08M).ToString("C");
            Gain6 = (openingPrice * 1.06M).ToString("C");
            Gain4 = (openingPrice * 1.04M).ToString("C");
            Gain2 = (openingPrice * 1.02M).ToString("C");

            Loss10 = (openingPrice * 0.9M).ToString("C");
            Loss8 = (openingPrice * 0.92M).ToString("C");
            Loss6 = (openingPrice * 0.94M).ToString("C");
            Loss4 = (openingPrice * 0.96M).ToString("C");
            Loss2 = (openingPrice * 0.98M).ToString("C");
        }
    }
}